Caddy 反代时注意的小地方

发现Rancher经过Caddy代理后,每次获取的都是CF的IP。那么就要来点处理啦。

Caddy有个PlaceHolder,这个是用法在这里

例子

1
2
3
4
5
6
7
8
9
10
proxy / http://localhost:60001 {
header_upstream Host {host}
header_upstream X-Real-IP {>CF-Connecting-IP}
header_upstream X-Forwarded-For {>X-Forwarded-For}
header_upstream X-Forwarded-Proto {>X-Forwarded-Proto}
header_upstream Connection {>Connection}

insecure_skip_verify
websocket
}

然后顺便遇到一个 Commandline 每次都会短时间被关闭,看了官方手册说是有一个proxy-read-timeout

嗯……这里的话 Caddy 手册下面的websocket preset应该是干这个用的。就是Connection 那个头。

所以先试试看效果咯。